<?php
class system extends ujn_controller {
	var $auto_render = false;
	//http://50.22.168.2/dice/_hookdoor/_datadoor.php?system-get_user || p=facebook&uid=1152
	
//	获取FLASH版本
	public function get_flash_version(){
		$v_url = ROOT . '/_tmp/cfg/v.php';
		if( file_exists( $v_url ) ){
			$flag = 1;
			$xdata = trim(file_get_contents($v_url, $version));
		}
		else{
			$flag = 0;
			$xdata = '';
		}
		
		if(empty($xdata)) $flag = 0;
		
		$data = array(
			'flag' => $flag,
			'lists' => $xdata,
		);
		echo json_encode( $data );
	}
	
	//设置FLASH版本
	public function set_flash_version(){
		$fversion = trim(isset($_REQUEST['fversion']) ? $_REQUEST['fversion'] : '');
		$v_url = ROOT . '/_tmp/cfg/v.php';
		if( file_exists( $v_url ) ){
			$flag = file_put_contents($v_url, $fversion) > 0 ? 1 : 0;
		}
		else{
			$flag = 0;
		}
		
		$data = array(
			'flag' => $flag,
		);
		echo json_encode( $data );
	}
	
	//获取FLASH参数
	public function get_flash_vars(){
		$fversion = trim(isset($_REQUEST['fversion']) ? $_REQUEST['fversion'] : '');
		$v_url = ROOT . '/_tmp/cfg/v.' . $fversion . '.php';
		
		if( file_exists( $v_url ) ){
			$flag = 1;
			$xdata = require_once($v_url);
		}
		else{
			$flag = 0;
			$xdata = array();
		}
		
		$data = array(
			'flag' => $flag, 
			'lists' => $xdata,
		);
		
		echo json_encode( $data );
	}
}